exports.articlesIndex = (req,res)=> {
  let article = global.dbHelper.getModel('article'); 

   article.find({},(error,doc) =>{
     if(error){
        logger.error("查找失败:"+error)
        res.json({
            "code": 500,
            "msg":"查找失败"
        })
     }else{
        for(var i = 0 ; i < doc.length ; i++){
            doc[i].blogText = doc[i].blogText.slice(doc[i].blogText.indexOf("<p"));
            doc[i].blogText = doc[i].blogText.replace(/<[^>]+>/ig,"");
            doc[i].blogText = doc[i].blogText.slice(0,100);
            doc[i].blogText = doc[i].blogText.replace(/\s+/g,"") + '...' ; 

        }
        console.log(doc)
        res.json({
            "code": 200,
            "msg": "查找成功",
            "result":doc
        })
     }
  }).sort({"time":-1}).limit(5)
   
 }
